package com.juc.threadPoolExecutor.threadPoolExecutor14;

import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class SynchronousQueueTest1 {

	public static void main(String[] args) {
		SynchronousQueue<Runnable> linked = new SynchronousQueue<>();
		System.out.println(linked.size());
		ThreadPoolExecutor executor = new ThreadPoolExecutor(2, 3, 5, TimeUnit.SECONDS, linked);
		executor.execute(new MyRunnable());
		executor.execute(new MyRunnable());
		executor.execute(new MyRunnable());
		System.out.println(executor.getPoolSize() + "     " + linked.size());
	    //直接执行3个任务
	}
}
